import 'dart:collection';

class UserDetailModel {
  String? imageUrl;
  int? grade;
  String? sex;
  String? nickname;
  List<GoodPosition>? goodPosition;
  int? matchCount;
  int? praisedCount;
  int? focusCount;
  String? breakAppointmentRate;
  String? age;
  String? height;
  String? weight;
  String? birthday;
  String? provinceName;
  String? provinceCode;
  String? cityName;
  String? cityCode;
  String? joinedDate;
  bool? isPraised;
  bool? isFocused;
  String? areaName;
  List<JoinedClubList>? joinedClubList;
  bool? isSelf;

  UserDetailModel(
      {this.imageUrl,
      this.grade,
      this.sex,
      this.nickname,
      this.goodPosition,
      this.matchCount,
      this.praisedCount,
      this.focusCount,
      this.breakAppointmentRate,
      this.age,
      this.height,
      this.weight,
      this.birthday,
      this.provinceName,
      this.provinceCode,
      this.cityName,
      this.cityCode,
      this.joinedDate,
      this.isPraised,
      this.isFocused,
      this.areaName,
      this.joinedClubList,
      this.isSelf});

  UserDetailModel.fromJson(Map<String, dynamic> json) {
    imageUrl = json['imageUrl'];
    grade = json['grade'];
    sex = json['sex'];
    nickname = json['nickname'];
    if (json['goodPosition'] != null) {
      goodPosition = <GoodPosition>[];
      json['goodPosition'].forEach((v) {
        if (v != null) {
          goodPosition!.add(GoodPosition.fromJson(v));
        }
      });
    }
    matchCount = json['matchCount'];
    praisedCount = json['praisedCount'];
    focusCount = json['focusCount'];
    breakAppointmentRate = json['breakAppointmentRate'];
    age = json['age'];
    height = json['height'];
    weight = json['weight'];
    birthday = json['birthday'];
    provinceName = json['provinceName'];
    provinceCode = json['provinceCode'];
    cityName = json['cityName'];
    cityCode = json['cityCode'];
    joinedDate = json['joinedDate'];
    isPraised = json['isPraised'];
    isFocused = json['isFocused'];
    areaName = json['areaName'];
    if (json['joinedClubList'] != null) {
      joinedClubList = <JoinedClubList>[];
      json['joinedClubList'].forEach((v) {
        if (v != null) {
          joinedClubList!.add( JoinedClubList.fromJson(v));
        }
      });
    }
    isSelf = json['isSelf'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['imageUrl'] = imageUrl;
    data['grade'] = grade;
    data['sex'] = sex;
    data['nickname'] = nickname;
    if (goodPosition != null) {
      data['goodPosition'] = goodPosition!.map((v) => v.toJson()).toList();
    }
    data['matchCount'] = matchCount;
    data['praisedCount'] = praisedCount;
    data['focusCount'] = focusCount;
    data['breakAppointmentRate'] = breakAppointmentRate;
    data['age'] = age;
    data['height'] = height;
    data['weight'] = weight;
    data['birthday'] = birthday;
    data['provinceName'] = provinceName;
    data['provinceCode'] = provinceCode;
    data['cityName'] = cityName;
    data['cityCode'] = cityCode;
    data['joinedDate'] = joinedDate;
    data['isPraised'] = isPraised;
    data['isFocused'] = isFocused;
    data['areaName'] = areaName;
    if (joinedClubList != null) {
      data['joinedClubList'] =
          joinedClubList!.map((v) => v.toJson()).toList();
    }
    data['isSelf'] = isSelf;
    return data;
  }
}

class GoodPosition {
  String? positionSortCode;
  String? positionSortDescription;
  String? subdivisionPosition;
  String? subdivisionPositionCode;

  GoodPosition(
      {this.positionSortCode,
      this.positionSortDescription,
      this.subdivisionPosition,
      this.subdivisionPositionCode});

  GoodPosition.fromJson(Map<String, dynamic> json) {
    positionSortCode = json['positionSortCode'];
    positionSortDescription = json['positionSortDescription'];
    subdivisionPosition = json['subdivisionPosition'];
    subdivisionPositionCode = json['subdivisionPositionCode'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['positionSortCode'] = positionSortCode;
    data['positionSortDescription'] = positionSortDescription;
    data['subdivisionPosition'] = subdivisionPosition;
    data['subdivisionPositionCode'] = subdivisionPositionCode;
    return data;
  }
}

class JoinedClubList {
  String? clubImgUrl;
  String? clubName;
  int? clubId;

  JoinedClubList({this.clubImgUrl, this.clubName, this.clubId});

  JoinedClubList.fromJson(Map<String, dynamic> json) {
    clubImgUrl = json['clubImgUrl'];
    clubName = json['clubName'];
    clubId = json['clubId'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = HashMap();
    data['clubImgUrl'] = clubImgUrl;
    data['clubName'] = clubName;
    data['clubId'] = clubId;
    return data;
  }
}